// import HomeView from '@/views/HomeView.vue'
// import NotFound from '@/views/NotFound.vue'
// import SearchView from '@/views/SearchView.vue'
import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'

const router = createRouter({
  //history: createWebHashHistory(),
  history: createWebHistory(),
  routes: [
    { path: '/find', component: () => import('@/views/findview.vue') },
     // redirect 重定向，避免首页白屏
    { path: '/', redirect: '/home' },
    { path: '/my', component: () => import('@/views/myview.vue') },
    { path: '/friend', component: () => import('@/views/friendview.vue') },
    { path: '/home', component:()=>import('@/views/HomeView.vue')},
     // 可选动态路由参数，避免无参数时白屏
    { path: '/search/:key?', component: () => import('@/views/SearchView.vue'),name: 'SearchView'},
      // 404 页面，避免路径不存在时白屏
    { path: '/:pathMatch(.*)*', component: () => import('@/views/NotFound.vue') }
  ]
})

export default router